<%--
  Created by IntelliJ IDEA.
  User: xiaoding
  Date: 2021/1/18
  Time: 16:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
    <title>发布公告</title>
    <link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/announce.css">
    <script src="bootstrap-3.3.7-dist/js/JQuery.js" type="text/javascript" charset="utf-8"></script>
    <script>
        $(document).ready(function() {
            $.ajax({
                url : "NextUserServlet?flag=selectJSON",//后台请求的数据，用的是PHP
                dataType : "json",//数据格式
                type : "post",//请求方式
                async : true,//是否异步请求
                success : function(data) {   //如果请求成功，返回数据。
                    //存储传输的数据
                    var json = "";
                    for (var i = 0;i<data.data.length;i++) {
                        //判断默认数据
                        if (data.data[i].uId == ${requestScope.announce.uId}) {
                            json += "<option selected value="+data.data[i].uId+">"+data.data[i].uName+"</option>";
                        }else {
                            json += "<option value="+data.data[i].uId+">"+data.data[i].uName+"</option>";
                        }
                    }
                    //将内容添加到发布人中
                    $("#uId").append(json);
                },
            })

            //添加内容
            $("#content").text('${requestScope.announce.content}');
        })
    </script>
</head>
<body>
<form action="NextAnnounceServlet?flag=update" class="popupWin" method="post" id="popupWin">
    <h3>修改公告</h3>
    <div class="popupWinInput">
        <input type="hidden" value="${param.page}" name="page" id="page">
        <input type="hidden" value="${param.titles}" name="titles" id="titles">
        <input type="hidden" value="${param.id}" name="id" id="id">
        <fmt:formatDate value="${requestScope.announce.publishingDate}" type="date" var="date1"/>
        <input type="hidden" value="${date1}" name="publishingDate" id="publishingDate">
        <p>
            <span>公告标题：</span>
            <input required="required" value="${requestScope.announce.title}" type="text" name="title" id="title">
        </p>
        <p>
            <span>发布人：</span>
            <select required="required" name="uId" id="uId">

            </select>
        </p>
        <p>
            <span>公告内容：</span>
            <textarea required="required"  name="content" rows="20" id="content">

            </textarea>
        </p>
    </div>
    <hr>
    <div class="popupWinButton">
        <input type="submit"  value="确定">
    </div>
</form>
</body>
</html>
